﻿; (function (window, undefined, $) {

    $(document).ready(function () {

       

        $("#formQuery").submit(function () {
            xjgrid.Query(this);
            return false;
        });
        $("#btnSearch").click(function () {
            $("#formQuery").submit();
        });

        $("#btnSave").click(function (e) {
            //审核通过
            AuditStatus(1);
        });
        $("#btnReturn").click(function (e) {
            //审核退回 
            AuditStatus(-1);
        });
        //审核操作
        function AuditStatus(status)
        {
            var id = $("#hideId").val();
            var remark = $("#Remark").val();
            layer.confirm("您确定要执行该操作吗？", function (index) {
                $.post(options.auditStatusUrl + "/" + id, { id: id,STATUS:status,REMARK:remark },
                      function (res) {
                          if (res.Status > 0) {
                              alert("操作成功！");
                              //layer.msg('操作成功！', 2, 9);
                              //var index = parent.layer.getFrameIndex(window.name);
                              try
                              {
                                  //var index = parent.layer.getFrameIndex(window.name);
                                  //parent.layer.close(index);
                                  window.parent.location.href = "/FundsFlow/Withdrawal.html";
                              }
                              catch(ex)
                              {
                                  alert(ex);
                              }
                          }
                          else {
                              layer.msg('操作失败！', 2, 8);
                          }
                      },
                      "json"
                );
            });
        }
        //关闭
        $("#btnClose").click(function () {
            //parent.document.getElementById("id").value = "ffggghhhhh";
            var index = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index);
        });
    });

})(window, undefined, jQuery);